﻿<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <span id="module">佛吉亚管理</span>
            <i class="fa fa-angle-right"></i>
        </li>
        <li>
            <span id="action"></span>
        </li>
    </ul>
</div>
<!-- END PAGE BAR -->
<div class="mt-bootstrap-tables" style="margin-top:20px">
    <div class="row">
        <div class="col-md-12">
            <div class="portlet light bordered">

                <div class="portlet-body form">
                    <!-- BEGIN FORM-->
                    <form id="defaultForm" class="form-horizontal" action="@Url.Action("ImportExcel")" method="post" novalidate="novalidate" enctype="multipart/form-data">
                        <div class="form-body">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            导出：
                                        </label>
                                        <div class="col-md-9 mt-checkbox-inline">
                                            <div class="input-icon right">
                                                <i class="fa"></i>
                                                <a href="@Url.Action("ExportExcel")" target="_blank">库存数据</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-6" style="display:none">
                                    <div class="form-group">
                                        <label class="control-label col-md-3">
                                            导入：
                                        </label>
                                        <div class="col-md-9">
                                            @*<div class="input-icon right">
                                                    <i class="fa"></i>
                                                    <a href="@Url.Action("ExportExcel")" target="_blank">导入库存并更新</a>
                                                </div>*@

                                            @*<div class="fileinput fileinput-new" data-provides="fileinput">
                                                    <span class="btn green btn-file">
                                                        <span class="fileinput-new"> Select file </span>
                                                        <span class="fileinput-exists"> Change </span>
                                                        <input type="file" name="...">
                                                    </span>
                                                    <span class="fileinput-filename"> </span> &nbsp;
                                                    <a href="javascript:;" class="close fileinput-exists" data-dismiss="fileinput"> </a>
                                                </div>*@

                                            <div class="fileinput fileinput-new" data-provides="fileinput">
                                                <div class="input-group input-large">
                                                    <div class="form-control uneditable-input input-fixed input-medium" data-trigger="fileinput">
                                                        <i class="fa fa-file fileinput-exists"></i>&nbsp;
                                                        <span class="fileinput-filename"> </span>
                                                    </div>
                                                    <span class="input-group-addon btn default btn-file">
                                                        <span class="fileinput-new"> 选择 </span>
                                                        <span class="fileinput-exists"> 修改 </span>
                                                        <input type="file" id="file" name="file" accept=".xls">
                                                    </span>
                                                    <a href="javascript:;" class="input-group-addon btn red fileinput-exists" data-dismiss="fileinput"> 删除 </a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                        <div class="form-actions" >
                            <div class="row">
                                <div class="col-md-offset-3 col-md-9">
                                    <button type="submit" class="btn green" style="display:none">更新</button>
                                    <button type="button" class="btn green" id="btnSync">同步库存</button>
                                    <button type="reset" class="btn" style="display:none">重置</button>
                                </div>
                            </div>
                        </div>

                        <div class="form-actions">
                            <div class="row">
                                <div id="lblMessage" class="col-md-offset-3 col-md-9" style="margin-left:0;">

                                </div>
                            </div>
                        </div>
                    </form>
                    <!-- END FORM-->
                </div>
            </div>
        </div>
    </div>
</div>
@section styles{
    <link href="~/Scripts/assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.css" rel="stylesheet" type="text/css" />
}
@section scripts{
    <script src="~/Scripts/assets/global/plugins/bootstrap-fileinput/bootstrap-fileinput.js" type="text/javascript"></script>
    <script type="text/javascript">
        var page = function () {

            var handle1 = function () {

                $('#btnSync').click(function () {
                    $.ajax({
                        type: 'POST',
                        url: '@Url.Action("SyncProductWarehouse")',
                        async: false,
                        success: function (reslut) {
                            if (reslut.Success) {
                                showToast(0, '系统提示', '同步成功');
                            } else {
                                showToast(3, '系统提示', reslut.Message);
                            }
                        },
                        error: function (request) {
                            showToast(3, '系统提示', ' 操作失败!');
                        }
                    });
                });

                var init = function () {

                };

                init();
            };

            return {
                init: function () {
                    handle1();
                }
            };
        }();

        $(document).ready(function () {
            page.init();

            var message = '@Html.Raw(TempData["message"])';

            if (message.length > 4) {
                $('#lblMessage').html('信息输出：<br>' + message);
            } else if (message.length > 1) {
                showToast(0, '系统提示', message);
            }
        });
    </script>
}
